package org.zecontech.extraplus;

import com.mojang.logging.LogUtils;
import com.terraformersmc.biolith.api.biome.BiomePlacement;
import net.minecraft.world.level.biome.Climate;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import org.slf4j.Logger;
import org.zecontech.extraplus.datagen.levelgen.ModBiomeProvider;
import org.zecontech.extraplus.init.ModBlocks;
import org.zecontech.extraplus.init.ModCreativeModeTabs;
import org.zecontech.extraplus.init.ModEntities;
import org.zecontech.extraplus.init.ModItems;

/**
 * 模组主类
 */
@Mod(ExtraPlus.MOD_ID)
public class ExtraPlus {

    // 模组命名空间
    public static final String MOD_ID = "extraplus";
    // 模组Logger
    public static final Logger LOGGER = LogUtils.getLogger();

    /**
     * 模组入口点
     * @param modEventBus 模组事件总线
     * @param modContainer 模组容器
     */
    public ExtraPlus(IEventBus modEventBus, ModContainer modContainer) {
        ModEntities.ENTITIES.register(modEventBus);// 注册模组实体、生物
        ModItems.ITEMS.register(modEventBus);//注册模组物品
        ModBlocks.BLOCKS.register(modEventBus);//注册模组方块
        modEventBus.addListener(ExtraPlus::commonSetup); // 注册模组事件
        ModCreativeModeTabs.CREATIVE_MODE_TABS.register(modEventBus);//注册模组创造模式物品栏
        modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);// 注册模组配置文件
    }

    public static void commonSetup(FMLCommonSetupEvent event) {
        event.enqueueWork(() -> {
            BiomePlacement.addOverworld(ModBiomeProvider.WILLOW_FOREST, Climate.parameters(0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.0f));
        });
    }
}
